Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User Submission History and User Stats #131

Merged
merged 8 commits into from
May 25, 2019
Merged

Conversation

rsvarma95
Copy link
Contributor

@rsvarma95 rsvarma95 commented May 23, 2019

User Submission History and User Stats

  • I have added a screen http://localhost:8080/stats that will display the Submission history and the Submission Statistics of a particular user
  • I have added the required function def statistics() in the python file
  • I have added the stats.html page for rendering the page

image

image

User Submission History and User Stats
@rishabhKalakoti
Copy link
Contributor

We have moved to peewee and mysqli with #126 , you should switch to database accordingly

@rishabhKalakoti
Copy link
Contributor

rishabhKalakoti commented May 23, 2019

I was thinking to have stats for individual users (similar to profiles in online judges), I think here we have stats for all the users. @theSage21 what do you think about this? How should we progress?

We can have this these type of stats for the contest/question though

Updated to include new db changes and user specific data
@rsvarma95
Copy link
Contributor Author

rsvarma95 commented May 23, 2019

Added User Specific Data and updated to incorporate sqlite changes

image
image

server.py Outdated Show resolved Hide resolved
server.py Outdated Show resolved Hide resolved
server.py Outdated Show resolved Hide resolved
Updated to check user session cookie, get count from already read database and directly convert to list
@rsvarma95
Copy link
Contributor Author

I have updated the code as per the review comments.

server.py Outdated Show resolved Hide resolved
@theSage21
Copy link
Member

theSage21 commented May 24, 2019 via email

@rsvarma95
Copy link
Contributor Author

Ok so I should be getting the user ID from bottle and using that to reference the records right? I don't know exactly how. I'll figure it out tomorrow.

@rishabhKalakoti
Copy link
Contributor

Maybe use something like:

sub_history_temp = Submission.select(
    ...
)
.where(
    Submission.user == Session.get(Session.token == bottle.request.get_cookie("s_id")).user
)
...

Updated to handle statsitics even if the session changes
@rsvarma95
Copy link
Contributor Author

I have deployed the code with the changes that Rishabh suggested.

server.py Outdated Show resolved Hide resolved
server.py Outdated Show resolved Hide resolved
server.py Outdated Show resolved Hide resolved
server.py Outdated Show resolved Hide resolved
server.py Outdated Show resolved Hide resolved
views/stats.html Outdated Show resolved Hide resolved
@rsvarma95
Copy link
Contributor Author

Updated the code as per the comments given above, @rishabhKalakoti and @theSage21

theSage21
theSage21 previously approved these changes May 25, 2019
Copy link
Member

@theSage21 theSage21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to go. Can you please run it through https://github.com/python/black

Formatted code
@rsvarma95
Copy link
Contributor Author

I have formatted the code using Black

@theSage21 theSage21 merged commit 11c89f0 into PyJaipur:master May 25, 2019
rsvarma95 added a commit to rsvarma95/PyJudge that referenced this pull request May 26, 2019
User Submission History and User Stats (PyJaipur#131)
rsvarma95 added a commit to rsvarma95/PyJudge that referenced this pull request May 26, 2019
User Submission History and User Stats (PyJaipur#131)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants